﻿using System.Reflection;
using Dsl.Ped.Common.Extensions;
using Dsl.Ped.Framework.Resources;

namespace Dsl.Ped.Framework.Helpers
{
    /// <summary>
    /// Helper methods for <see cref="string"/>
    /// </summary>
    public class StringHelper
    {
        /// <summary>
        /// Localize the string against the Lang dictionary
        /// </summary>
        /// <param name="str"><see cref="string"/> to be localized</param>
        /// <returns>Localized dictionary item if exists, string itself otherwise</returns>
        public static string Localize(string str)
        {
            return (str == null) ? str : str.Localize(Assembly.GetExecutingAssembly(), typeof (Lang).FullName);
        }
    }
}
